.class public Lcom/android/inputmethod/latin/CandidateViewContainer;
.super Landroid/widget/LinearLayout;
.source "CandidateViewContainer.java"

# interfaces
.implements Landroid/view/View$OnTouchListener;


# instance fields
.field private mButtonLeft:Landroid/view/View;

.field private mButtonLeftLayout:Landroid/view/View;

.field private mButtonRight:Landroid/view/View;

.field private mButtonRightLayout:Landroid/view/View;

.field private mCandidates:Lcom/android/inputmethod/latin/CandidateView;


# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0
    .parameter "screen"
    .parameter "attrs"

    .prologue
    .line 35
    invoke-direct {p0, p1, p2}, Landroid/widget/LinearLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 36
    return-void
.end method


# virtual methods
.method public initViews()V
    .locals 1

    .prologue
    .line 39
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mCandidates:Lcom/android/inputmethod/latin/CandidateView;

    if-nez v0, :cond_2

    .line 40
    const/high16 v0, 0x7f0b

    invoke-virtual {p0, v0}, Lcom/android/inputmethod/latin/CandidateViewContainer;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonLeftLayout:Landroid/view/View;

    .line 41
    const v0, 0x7f0b0001

    invoke-virtual {p0, v0}, Lcom/android/inputmethod/latin/CandidateViewContainer;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonLeft:Landroid/view/View;

    .line 42
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonLeft:Landroid/view/View;

    if-eqz v0, :cond_0

    .line 43
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonLeft:Landroid/view/View;

    invoke-virtual {v0, p0}, Landroid/view/View;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

    .line 45
    :cond_0
    const v0, 0x7f0b0003

    invoke-virtual {p0, v0}, Lcom/android/inputmethod/latin/CandidateViewContainer;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonRightLayout:Landroid/view/View;

    .line 46
    const v0, 0x7f0b0004

    invoke-virtual {p0, v0}, Lcom/android/inputmethod/latin/CandidateViewContainer;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iput-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonRight:Landroid/view/View;

    .line 47
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonRight:Landroid/view/View;

    if-eqz v0, :cond_1

    .line 48
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonRight:Landroid/view/View;

    invoke-virtual {v0, p0}, Landroid/view/View;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

    .line 50
    :cond_1
    const v0, 0x7f0b0002

    invoke-virtual {p0, v0}, Lcom/android/inputmethod/latin/CandidateViewContainer;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Lcom/android/inputmethod/latin/CandidateView;

    iput-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mCandidates:Lcom/android/inputmethod/latin/CandidateView;

    .line 52
    :cond_2
    return-void
.end method

.method public onTouch(Landroid/view/View;Landroid/view/MotionEvent;)Z
    .locals 1
    .parameter "v"
    .parameter "event"

    .prologue
    .line 73
    invoke-virtual {p2}, Landroid/view/MotionEvent;->getAction()I

    move-result v0

    if-nez v0, :cond_0

    .line 74
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonRight:Landroid/view/View;

    if-ne p1, v0, :cond_1

    .line 75
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mCandidates:Lcom/android/inputmethod/latin/CandidateView;

    invoke-virtual {v0}, Lcom/android/inputmethod/latin/CandidateView;->scrollNext()V

    .line 80
    :cond_0
    :goto_0
    const/4 v0, 0x0

    return v0

    .line 76
    :cond_1
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonLeft:Landroid/view/View;

    if-ne p1, v0, :cond_0

    .line 77
    iget-object v0, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mCandidates:Lcom/android/inputmethod/latin/CandidateView;

    invoke-virtual {v0}, Lcom/android/inputmethod/latin/CandidateView;->scrollPrev()V

    goto :goto_0
.end method

.method public requestLayout()V
    .locals 9

    .prologue
    const/16 v8, 0x8

    const/4 v6, 0x1

    const/4 v7, 0x0

    .line 56
    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mCandidates:Lcom/android/inputmethod/latin/CandidateView;

    if-eqz v5, :cond_1

    .line 57
    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mCandidates:Lcom/android/inputmethod/latin/CandidateView;

    invoke-virtual {v5}, Lcom/android/inputmethod/latin/CandidateView;->getWidth()I

    move-result v0

    .line 58
    .local v0, availableWidth:I
    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mCandidates:Lcom/android/inputmethod/latin/CandidateView;

    invoke-virtual {v5}, Lcom/android/inputmethod/latin/CandidateView;->computeHorizontalScrollRange()I

    move-result v2

    .line 59
    .local v2, neededWidth:I
    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mCandidates:Lcom/android/inputmethod/latin/CandidateView;

    invoke-virtual {v5}, Lcom/android/inputmethod/latin/CandidateView;->getScrollX()I

    move-result v4

    .line 60
    .local v4, x:I
    if-lez v4, :cond_2

    move v1, v6

    .line 61
    .local v1, leftVisible:Z
    :goto_0
    add-int v5, v4, v0

    if-ge v5, v2, :cond_3

    move v3, v6

    .line 62
    .local v3, rightVisible:Z
    :goto_1
    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonLeftLayout:Landroid/view/View;

    if-eqz v5, :cond_0

    .line 63
    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonLeftLayout:Landroid/view/View;

    if-eqz v1, :cond_4

    move v6, v7

    :goto_2
    invoke-virtual {v5, v6}, Landroid/view/View;->setVisibility(I)V

    .line 65
    :cond_0
    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonRightLayout:Landroid/view/View;

    if-eqz v5, :cond_1

    .line 66
    iget-object v5, p0, Lcom/android/inputmethod/latin/CandidateViewContainer;->mButtonRightLayout:Landroid/view/View;

    if-eqz v3, :cond_5

    move v6, v7

    :goto_3
    invoke-virtual {v5, v6}, Landroid/view/View;->setVisibility(I)V

    .line 69
    .end local v0           #availableWidth:I
    .end local v1           #leftVisible:Z
    .end local v2           #neededWidth:I
    .end local v3           #rightVisible:Z
    .end local v4           #x:I
    :cond_1
    invoke-super {p0}, Landroid/widget/LinearLayout;->requestLayout()V

    .line 70
    return-void

    .restart local v0       #availableWidth:I
    .restart local v2       #neededWidth:I
    .restart local v4       #x:I
    :cond_2
    move v1, v7

    .line 60
    goto :goto_0

    .restart local v1       #leftVisible:Z
    :cond_3
    move v3, v7

    .line 61
    goto :goto_1

    .restart local v3       #rightVisible:Z
    :cond_4
    move v6, v8

    .line 63
    goto :goto_2

    :cond_5
    move v6, v8

    .line 66
    goto :goto_3
.end method
